package com.wa.service.impl;

import com.wa.annotation.AllchipsLogProcessServiceType;
import com.wa.page.BaseNoticeLogEntity;
import com.wa.bean.BasicAllchipsLog;
import com.wa.dto.OperatorInfoDto;
import com.wa.pojo.BasicAllchipsLogPojo;
import com.wa.service.AbstractAllchipsLogProcessService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

/**
 * 日志处理--通知日志
 *
 * @author: Homan Liang
 * @time: 2021/10/22 15:49
 */
@AllchipsLogProcessServiceType(logCategory = 30)
@Service
public class NoticeAllchipsLogProcessServiceImpl extends AbstractAllchipsLogProcessService {

    /**
     * 日志处理
     *
     * @param dataObject
     * @param basicAllchipsLogPojo
     * @param operatorInfoDto
     * @throws Exception
     */
    @Override
    public void processLog0(Object dataObject, BasicAllchipsLogPojo basicAllchipsLogPojo, OperatorInfoDto operatorInfoDto) throws Exception {
        BaseNoticeLogEntity baseNoticeLogEntity = new BaseNoticeLogEntity(dataObject);

        basicAllchipsLogPojo.setBasicAllchipsLogs(new ArrayList<>());
        BasicAllchipsLog basicAllchipsLog = new BasicAllchipsLog(operatorInfoDto);
        basicAllchipsLogPojo.getBasicAllchipsLogs().add(basicAllchipsLog);

        basicAllchipsLog.setTitle(baseNoticeLogEntity.getTitle());
        basicAllchipsLog.setContent(baseNoticeLogEntity.getContent());
        basicAllchipsLog.setReceiver(baseNoticeLogEntity.getReceiver());
    }
}
